home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
NEW_TECH
/
HYPERO.ZIP
/
roidsupp.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-04-12
|
19KB
|
545 lines
// ***************************************************************************
// ROIDSUPP.C - hyperoid support functions
//
// Version: 1.1 Copyright (C) 1990,91 Hutchins Software
// This software is licenced under the GNU General Public Licence
// Please read the associated legal documentation
//
// Author: Edward Hutchins
// Internet: eah1@cec1.wustl.edu
// USMail: c/o Edward Hutchins, 63 Ridgemoor Dr., Clayton, MO, 63105
//
// Revisions:
// 11/01/91 added GNU General Public License - Ed.
//
// Music: R.E.M./The Cure/Ministry/Front 242/The Smiths/New Order/Hendrix...
// Beers: Bass Ale, Augsberger Dark
//
// 03/04/92 ported to Win32 - Paul Tissue & Robert Hess [Microsoft].
// ***************************************************************************
#include "hyperoid.h"
//
// defines
//
// You may ask, "why did he embed all these string constants instead of
// using the resource file?". Good question. The answer is: I feel better
// knowing this stuff is part of the executable, and not part of the resource
// file (which can be changed by sneaky people). Or maybe I wuz lazy.
// If you don't like it, then YOU can change it!
#define NL "\x0d\x0a"
#define HYPEROID_HELP \
"The following keys control your ship:" NL NL \
" Left, Right Arrow .... spin left or right" NL \
" Down, Up Arrow ..... forward or reverse thrust" NL \
" Space Bar .............. fire!" NL \
" Tab ......................... shields" NL \
" S ............................. smartbomb" NL \
" Esc ......................... pause/boss key" NL NL \
"Note: You have 3 lives, unlimited fuel and firepower, 3 shields and 3 " \
"smartbombs. Your ship gets darker when you lose a life, but you keep on " \
"playing (unless you hit an asteroid). You get an extra life every 100,000 " \
"points. When you lose the game, you start over immediately and can finish " \
"off the current level (which should now be 0) before starting over at " \
"level 1 (There is no waiting around between games)."
#define HYPEROID_HELP2 \
"The HYPEROID.INI file can be created/modified to change default settings " \
"in Hyperoid. Here are some of the items you can set:" NL \
NL "[Hyperoid]" NL "Max=<0/1>" NL "{X,Y,W,H}=<n>" NL "Mono=<0/1>" NL \
"DrawDelay=<ms> ;microseconds/frame" NL \
NL "[Palette]" NL \
"{Black,DkGrey,Grey,White," NL \
" DkRed,Red,DkGreen,Green,DkBlue,Blue," NL \
" DkYellow,Yellow,DkCyan,Cyan," NL \
" DkMagenta,Magenta}=<r>,<g>,<b>" NL \
NL "[Keys]" NL \
"{Shield,Clockwise,CtrClockwise," NL \
" Thrust,RevThrust,Fire,Bomb}=<virtual keycode>" NL NL \
"Note: Virtual keycodes usually match the key's ASCII value."
#define HYPEROID_HELPSTYLE (MB_OK | MB_ICONASTERISK)
// this is the part I especially want in the executable image
#define HYPEROID_LICENSE \
"This program is free software; you can redistribute it and/or modify " \
"it under the terms of the GNU General Public License as published by " \
"the Free Software Foundation; either version 1, or (at your option) " \
"any later version. " \
NL NL \
"This program is distributed in the hope that it will be useful, " \
"but WITHOUT ANY WARRANTY; without even the implied warranty of " \
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the " \
"GNU General Public License for more details. " \
NL NL \
"You should have received a copy of the GNU General Public License " \
"along with this program; if not, write to the Free Software " \
"Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. "
//
// imports
//
IMPORT CHAR szAppName[32] FROM ( hyperoid.c );
IMPORT HANDLE hAppInst FROM ( hyperoid.c );
IMPORT HWND hAppWnd FROM ( hyperoid.c );
IMPORT BOOL bBW FROM ( hyperoid.c );
IMPORT INT nDrawDelay FROM ( hyperoid.c );
IMPORT INT vkShld FROM ( hyperoid.c );
IMPORT INT vkClkw FROM ( hyperoid.c );
IMPORT INT vkCtrClkw FROM ( hyperoid.c );
IMPORT INT vkThrst FROM ( hyperoid.c );
IMPORT INT vkRvThrst FROM ( hyperoid.c );
IMPORT INT vkFire FROM ( hyperoid.c );
IMPORT INT vkBomb FROM ( hyperoid.c );
IMPORT LONG lHighScore FROM ( hyperoid.c );
//
// globals
//
// these parts map to "abcdefghijklm"
GLOBAL POINT LetterPart[] =
{
{83, 572}, {64, 512}, {45, 572}, {96, 362}, {32, 362},
{128, 256}, {0, 0}, {0, 256},
{160, 362}, {224, 362}, {173, 572}, {192, 512}, {211, 572}
};
// here's the vector font
GLOBAL LPSTR szNumberDesc[] =
{
"cakmck", // 0
"dbl", // 1
"abekm", // 2
"abegjlk", // 3
"mcfh", // 4
"cbfgjlk", // 5
"bdiljgi", // 6
"acgl", // 7
"bdjlieb", // 8
"ljebdge" // 9
};
GLOBAL LPSTR szLetterDesc[] =
{
"kdbemhf", // A
"kabegjlk", // B
"cbflm", // C
"kabejlk", // D
"cafgfkm", // E
"cafgfk", // F
"bdiljhg", // G
"kafhcm", // H
"bl", // I
"cjli", // J
"akcgm", // K
"akm", // L
"kagcm", // M
"kamc", // N
"bdiljeb", // O
"kabegf", // P
"mlidbejl", // Q
"kabegfgm", // R
"ebdjli", // S
"lbac", // T
"ailjc", // U
"alc", // V
"akgmc", // W
"amgkc", // X
"aglgc", // Y
"ackm" // Z
};
//
// locals
//
LOCAL CHAR szIni[] = "HYPEROID.INI";
LOCAL CHAR szLicense[] = "LicenseRead";
LOCAL CHAR szDrawDelay[] = "DrawDelay";
LOCAL CHAR szMax[] = "Max";
LOCAL CHAR szX[] = "X";
LOCAL CHAR szY[] = "Y";
LOCAL CHAR szW[] = "W";
LOCAL CHAR szH[] = "H";
LOCAL CHAR szBW[] = "Mono";
LOCAL CHAR szPalette[] = "Palette";
LOCAL CHAR szKeys[] = "Keys";
LOCAL CHAR szShield[] = "Shield";
LOCAL CHAR szClockwise[] = "Clockwise";
LOCAL CHAR szCtrClockwise[] = "CtrClockwise";
LOCAL CHAR szThrust[] = "Thrust";
LOCAL CHAR szRevThrust[] = "RevThrust";
LOCAL CHAR szFire[] = "Fire";
LOCAL CHAR szBomb[] = "Bomb";
LOCAL CHAR szHi[] = "Hi";
LOCAL CHAR *szColorName[] =
{
"Black", "DkGrey", "Grey", "White",
"DkRed", "Red", "DkGreen", "Green", "DkBlue", "Blue",
"DkYellow", "Yellow", "DkCyan", "Cyan", "DkMagenta", "Magenta"
};
LOCAL DWORD dwColors[] =
{
RGB(0,0,0), RGB(128,128,128),
RGB(192,192,192), RGB(255,255,255),
RGB(128,0,0), RGB(255,0,0),
RGB(0,128,0), RGB(0,255,0),
RGB(0,0,128), RGB(0,0,255),
RGB(128,128,0), RGB(255,255,0),
RGB(0,128,128), RGB(0,255,255),
RGB(128,0,128), RGB(255,0,255),
};
// ***************************************************************************
// PrintLetters - create letter objects from a string
// ***************************************************************************
VOID APIENTRY
PrintLetters( LPSTR lpszText, POINT Pos, POINT Vel, BYTE byColor, INT nSize )
{
INT nLen = strlen( lpszText );
INT nCnt = nLen;
INT nSpace = nSize + nSize / 2;
INT nBase = (nLen - 1) * nSpace;
INT nBaseStart = Pos.x + nBase / 2;
while (nCnt--)
{
NPOBJ npLtr = CreateLetter( lpszText[nCnt],
nSize / 2, 20 + arand(70));
if (npLtr)
{
npLtr->Pos.x = nBaseStart;
npLtr->Pos.y = Pos.y;
npLtr->Vel = Vel;
npLtr->byColor = byColor;
}
nBaseStart -= nSpace;
}
}
// ***************************************************************************
/